package com.silence.springboot.service.impl;


import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.silence.springboot.dao.AuthorInfoDao;
import com.silence.springboot.entity.AuthorInfoEntity;
import com.silence.springboot.mapper.AuthorInfoMapper;
import com.silence.springboot.service.AuthorInfoService;
import com.silence.springboot.vo.input.SelectAuthorInput;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 作者信息表 服务层实现。
 *
 * @author mybatis-flex-helper automatic generation
 * @since 1.0
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class AuthorInfoServiceImpl extends ServiceImpl<AuthorInfoMapper, AuthorInfoEntity> implements AuthorInfoService {

    /**
     * 作者信息表 数据访问层实现
     */
    private final AuthorInfoDao authorDao;

    /**
     * 查询作者信息
     *
     * @param input 作者信息表入参
     * @return 作者信息表出参
     */
    @Override
    public List<AuthorInfoEntity> selectAuthor(SelectAuthorInput input) {
        // 获取作者姓名
        String bookAuthorName = input.getBookAuthorName();
        // 查询数据库中的作者编号
        return authorDao.selectAuthorByQuery(bookAuthorName);
    }

}